﻿//载入基础页面
{extend name="common/base" /}

//页面单独CSS
{block name="CustomCSS"}

{/block}

//页面单独JS
{block name="CustomJS"}
<script src="__STATIC__/vendors/js/components/validation/validation.min.js"></script>
<script src="__STATIC__/vendors/js/jquery.form/jquery.form.min.js"></script>
<script src="__STATIC__/vendors/js/noty/noty.min.js"></script>
<script src="__STATIC__/vendors/js/daterangepicker/moment.min.js"></script>
<script src="__STATIC__/vendors/js/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript">
	$(document).ready(function () {
		//single date
		$('#date').daterangepicker({
			singleDatePicker: true,
			autoUpdateInput: false,
			locale: {
				format:'YYYY-MM',
			}
		},function(start,end) {
            this.autoUpdateInput = true//选完日期后打开自动赋值
        });
        $("#ajaxForm").ajaxForm({
            //定义返回JSON数据，还包括xml和script格式
            dataType: 'json',
			//在发送之前进行的操作，如果有问题，返回false即可不会进行提交
            beforeSend: function () {
            	//定义 form为当前表格
                const form = $("#ajaxForm")

				//如果没有完成校验就返回false不提交
				if (form[0].checkValidity() === false){
					return false;
				}
            },
            success: function (data) {
                //提交成功后调用
                new Noty({
		            type: "success",
		            layout: "topRight",
		            text: "成功修改一条数据，ID为" + data,
		            progressBar: true,
		            timeout: 2500,
		            animation: {
		                open: "animated bounceInRight",
		                close: "animated bounceOutRight"
		            },
		            callbacks: {
		            	afterShow: function() {
		            		$(location).attr('href', '{:url('Budget/index')}');
		            	},
		            }
		        }).show();
                return false;
            },
            error: function(XmlHttpRequest, textStatus, errorThrown){  
                //提交成功后调用
                new Noty({
		            type: "error",
		            layout: "topRight",
		            text: "数据添加失败",
		            progressBar: true,
		            timeout: 2500,
		            animation: {
		                open: "animated bounceInRight",
		                close: "animated bounceOutRight"
		            }
		        }).show();
		        return false;
            } 
        });
	});
 
</script>
{/block}

//页面显示名称
{block name="PageName"}
添加单月预算
{/block}

//主页面代码
{block name="main"}
<div class="row">
    <div class="col-xl-12">
        <div class="widget has-shadow">
        	<div class="widget-header bordered no-actions d-flex align-items-center">
                <h2>添加单月预算</h2>
            </div>
            <div class="widget-body">
                <form class="needs-validation" novalidate="" id="ajaxForm" action="{:url('Budget/update',['id' => $data.id])}">
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">月份 *</label>
	                    <div class="col-xl-9">
	                        <input type="date" class="form-control" placeholder="请输入月份" required name="date" id="date" value="{$data.date|date='Y/m'}">
	                        <div class="invalid-feedback">
	                        	请输入月份
	                    	</div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">广宣费 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入广宣费" required name="propaganda" value="{$data.propaganda}">
	                        <div class="invalid-feedback">
	                            请输入广宣费
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">展览费 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入展览费" required name="show" value="{$data.show}">
	                        <div class="invalid-feedback">
	                            请输入展览费
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">活动费 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入活动费" required name="activity" value="{$data.activity}">
	                        <div class="invalid-feedback">
	                            请输入活动费
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">物料费 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入物料费" required name="material" value="{$data.material}">
	                        <div class="invalid-feedback">
	                            请输入物料费
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">客服费 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入客服费" required name="service" value="{$data.service}">
	                        <div class="invalid-feedback">
	                            请输入客服费
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">台次目标任务 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="1" class="form-control" placeholder="请输入台次目标任务" required name="car_task" value="{$data.car_task}">
	                        <div class="invalid-feedback">
	                            请输入台次目标任务
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">客流目标任务 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="1" class="form-control" placeholder="请输入客流目标任务" required name="visitor_task" value="{$data.visitor_task}">
	                        <div class="invalid-feedback">
	                            请输入客流目标任务
	                        </div>
	                    </div>
	                </div>
	                <div class="form-group row d-flex align-items-center mb-5">
	                    <label class="col-xl-3 form-control-label d-flex justify-content-lg-end">厂家预估支持 *</label>
	                    <div class="col-xl-9">
	                        <input type="number" step="0.01" class="form-control" placeholder="请输入厂家预估支持" required name="support" value="{$data.support}">
	                        <div class="invalid-feedback">
	                            请输入厂家预估支持
	                        </div>
	                    </div>
	                </div>
	                <div class="text-right">
		                <button class="btn btn-shadow" type="reset" onclick="history.go(-1);">取消</button>
		                <button class="btn btn-gradient-01" type="submit">提交</button>
		            </div>
		        </form>
            </div>
        </div>
        <!-- End Export -->
    </div>
</div>
{/block}//主页面
